package ch.janotta.slawo.ultraquest.encounters.trainer;

import java.util.HashMap;

import ch.janotta.slawo.ultraquest.utilities.Dice;

public final class TrainingFactory {
  private static HashMap<String, Training> TRAININGS = new HashMap<>();

  static {
    TRAININGS.put("Speed",     new SpeedTraining());
    TRAININGS.put("Strength",  new StrengthTraining());
    TRAININGS.put("Dexterity", new DexterityTraining());
    TRAININGS.put("Dexterity", new DexterityTraining());
    TRAININGS.put("Forest",    new ForestTraining());
    TRAININGS.put("Marsh",     new MarshTraining());
    TRAININGS.put("Plains",    new PlainsTraining());
  };

  public static String getRandomTrainingKey() {
    int randomItem = Dice.getRandomNumber(TRAININGS.size()) - 1;
    String[] keys = TRAININGS.keySet().toArray(new String[0]);
    return keys[randomItem];
  }

  public static Training getTraining(String trainingKey) {
    return TRAININGS.get(trainingKey);
  }
}
